package cn.jbt.api.admin.controller;

import cn.jbt.api.admin.annotation.Log;
import cn.jbt.api.admin.util.MinioUtil;
import cn.jbt.common.MinioUploadResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/minio")
@Slf4j
public class MinioController {

    /**
     * <h2>文件上传</h2>
     */
    @PostMapping("/upload")
    @Log(bizType = "上传", bizName = "文件上传 - MinIO")
    public MinioUploadResult upload(@RequestPart("file") MultipartFile file) {
        return MinioUtil.uploadFile(file);
    }

}
